<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SpringBoot整合JPA - 现代化开发指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        .text-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        .drop-cap::first-letter {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 0.5rem;
            font-weight: 700;
            color: #667eea;
        }
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6">
            <div class="text-center">
                <h1 class="text-5xl md:text-6xl font-bold mb-4">
                    <i class="fas fa-code mr-4"></i>SpringBoot整合JPA
                </h1>
                <p class="text-xl md:text-2xl mb-8 opacity-90">构建现代化企业级应用的最佳实践</p>
                <div class="flex justify-center space-x-4">
                    <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full">
                        <i class="fas fa-rocket mr-2"></i>快速开发
                    </span>
                    <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full">
                        <i class="fas fa-database mr-2"></i>数据持久化
                    </span>
                    <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full">
                        <i class="fas fa-shield-alt mr-2"></i>企业级架构
                    </span>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto px-6 py-12">
        <!-- Introduction Card -->
        <div class="bg-white rounded-2xl shadow-xl p-8 mb-12 card-hover">
            <h2 class="text-3xl font-bold mb-6 text-gray-800">
                <i class="fas fa-lightbulb text-yellow-500 mr-3"></i>为什么选择SpringBoot + JPA？
            </h2>
            <p class="text-lg text-gray-600 leading-relaxed drop-cap">
                在现代Java开发中，SpringBoot与JPA的组合已经成为构建企业级应用的黄金搭档。SpringBoot简化了Spring应用的配置和部署，而JPA（Java Persistence API）则提供了优雅的对象关系映射解决方案。这种组合不仅能够大幅提升开发效率，还能确保代码的可维护性和扩展性。
            </p>
        </div>

        <!-- Core Concepts Grid -->
        <div class="grid md:grid-cols-3 gap-8 mb-12">
            <div class="bg-white rounded-xl shadow-lg p-6 card-hover">
                <div class="text-4xl text-purple-600 mb-4">
                    <i class="fas fa-layer-group"></i>
                </div>
                <h3 class="text-xl font-bold mb-3">分层架构</h3>
                <p class="text-gray-600">采用Controller-Service-Repository三层架构，实现关注点分离，提高代码可维护性。</p>
            </div>
            <div class="bg-white rounded-xl shadow-lg p-6 card-hover">
                <div class="text-4xl text-blue-600 mb-4">
                    <i class="fas fa-magic"></i>
                </div>
                <h3 class="text-xl font-bold mb-3">自动配置</h3>
                <p class="text-gray-600">SpringBoot的自动配置机制，让你专注于业务逻辑，而非繁琐的配置文件。</p>
            </div>
            <div class="bg-white rounded-xl shadow-lg p-6 card-hover">
                <div class="text-4xl text-green-600 mb-4">
                    <i class="fas fa-sync-alt"></i>
                </div>
                <h3 class="text-xl font-bold mb-3">ORM映射</h3>
                <p class="text-gray-600">JPA提供强大的对象关系映射能力，让数据库操作变得简单直观。</p>
            </div>
        </div>

        <!-- Architecture Visualization -->
        <div class="bg-white rounded-2xl shadow-xl p-8 mb-12">
            <h2 class="text-3xl font-bold mb-6 text-gray-800">
                <i class="fas fa-sitemap text-indigo-500 mr-3"></i>架构概览
            </h2>
            <div class="mermaid">
                graph TB
                    A[客户端请求] --> B[Controller层]
                    B --> C[Service层]
                    C --> D[Repository层]
                    D --> E[JPA/Hibernate]
                    E --> F[数据库]
                    
                    style A fill:#f9f,stroke:#333,stroke-width:2px
                    style B fill:#bbf,stroke:#333,stroke-width:2px
                    style C fill:#bfb,stroke:#333,stroke-width:2px
                    style D fill:#fbf,stroke:#333,stroke-width:2px
                    style E fill:#fbb,stroke:#333,stroke-width:2px
                    style F fill:#bff,stroke:#333,stroke-width:2px
            </div>
        </div>

        <!-- Key Features -->
        <div class="bg-gradient-to-r from-purple-50 to-blue-50 rounded-2xl p-8 mb-12">
            <h2 class="text-3xl font-bold mb-8 text-center text-gradient">核心特性</h2>
            <div class="grid md:grid-cols-2 gap-6">
                <div class="flex items-start">
                    <i class="fas fa-check-circle text-green-500 text-2xl mr-4 mt-1"></i>
                    <div>
                        <h4 class="font-bold text-lg mb-2">声明式事务管理</h4>
                        <p class="text-gray-600">使用@Transactional注解轻松管理事务边界</p>
                    </div>
                </div>
                <div class="flex items-start">
                    <i class="fas fa-check-circle text-green-500 text-2xl mr-4 mt-1"></i>
                    <div>
                        <h4 class="font-bold text-lg mb-2">动态查询构建</h4>
                        <p class="text-gray-600">支持方法名查询、@Query注解和Criteria API</p>
                    </div>
                </div>
                <div class="flex items-start">
                    <i class="fas fa-check-circle text-green-500 text-2xl mr-4 mt-1"></i>
                    <div>
                        <h4 class="font-bold text-lg mb-2">分页与排序</h4>
                        <p class="text-gray-600">内置分页和排序支持，轻松处理大数据集</p>
                    </div>
                </div>
                <div class="flex items-start">
                    <i class="fas fa-check-circle text-green-500 text-2xl mr-4 mt-1"></i>
                    <div>
                        <h4 class="font-bold text-lg mb-2">审计功能</h4>
                        <p class="text-gray-600">自动记录创建时间、修改时间等审计信息</p>
                    </div>
                </div>
            </div>
        </div>

        <!-- Best Practices -->
        <div class="bg-white rounded-2xl shadow-xl p-8 mb-12">
            <h2 class="text-3xl font-bold mb-6 text-gray-800">
                <i class="fas fa-star text-yellow-400 mr-3"></i>最佳实践
            </h2>
            <div class="space-y-4">
                <div class="border-l-4 border-purple-500 pl-6 py-2">
                    <h4 class="font-bold text-lg mb-2">1. 合理使用懒加载与急加载</h4>
                    <p class="text-gray-600">根据业务场景选择FetchType.LAZY或FetchType.EAGER，避免N+1查询问题</p>
                </div>
                <div class="border-l-4 border-blue-500 pl-6 py-2">
                    <h4 class="font-bold text-lg mb-2">2. 使用DTO进行数据传输</h4>
                    <p class="text-gray-600">避免直接暴露实体类，使用DTO模式保护领域模型</p>
                </div>
                <div class="border-l-4 border-green-500 pl-6 py-2">
                    <h4 class="font-bold text-lg mb-2">3. 合理设计Repository接口</h4>
                    <p class="text-gray-600">遵循单一职责原则，避免Repository接口过于臃肿</p>
                </div>
                <div class="border-l-4 border-yellow-500 pl-6 py-2">
                    <h4 class="font-bold text-lg mb-2">4. 使用数据库迁移工具</h4>
                    <p class="text-gray-600">集成Flyway或Liquibase管理数据库版本</p>
                </div>
            </div>
        </div>

        <!-- Quick Start Guide -->
        <div class="bg-gray-900 text-white rounded-2xl p-8 mb-12">
            <h2 class="text-3xl font-bold mb-6">
                <i class="fas fa-rocket mr-3"></i>快速开始
            </h2>
            <div class="space-y-6">
                <div>
                    <h3 class="text-xl font-semibold mb-3">1. 添加依赖</h3>
                    <div class="bg-gray-800 rounded-lg p-4 font-mono text-sm">
                        <span class="text-green-400">&lt;dependency&gt;</span><br>
                        &nbsp;&nbsp;<span class="text-blue-400">&lt;groupId&gt;</span>org.springframework.boot<span class="text-blue-400">&lt;/groupId&gt;</span><br>
                        &nbsp;&nbsp;<span class="text-blue-400">&lt;artifactId&gt;</span>spring-boot-starter-data-jpa<span class="text-blue-400">&lt;/artifactId&gt;</span><br>
                        <span class="text-green-400">&lt;/dependency&gt;</span>
                    </div>
                </div>
                <div>
                    <h3 class="text-xl font-semibold mb-3">2. 配置数据源</h3>
                    <div class="bg-gray-800 rounded-lg p-4 font-mono text-sm">
                        <span class="text-yellow-400">spring.datasource.url</span>=jdbc:mysql://localhost:3306/mydb<br>
                        <span class="text-yellow-400">spring.jpa.hibernate.ddl-auto</span>=update<br>
                        <span class="text-yellow-400">spring.jpa.show-sql</span>=true
                    </div>
                </div>
            </div>
        </div>

        <!-- Call to Action -->
        <div class="text-center py-12">
            <h2 class="text-3xl font-bold mb-6 text-gray-800">准备好开始了吗？</h2>
            <p class="text-xl text-gray-600 mb-8">探索SpringBoot与JPA的强大组合，构建下一代企业级应用</p>
            <a href="https://www.yuque.com/docs/share/448873de-429a-4bf2-9816-93aeb7802f46?# 《SpringBoot整合JPA》" 
               target="_blank" 
               class="inline-flex items-center bg-gradient-to-r from-purple-600 to-blue-600 text-white font-bold py-4 px-8 rounded-full hover:shadow-lg transform hover:scale-105 transition-all duration-300">
                <i class="fas fa-book-open mr-3"></i>
                查看完整文档
            </a>
        </div>
    </main>

    <script>
        mermaid.initialize({ startOnLoad: true, theme: 'default' });
    </script>
</body>
</html>